package com.arron.ssm.controller;

import com.arron.ssm.entity.User;
import com.arron.ssm.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;
import java.util.Map;

/**
 * @Classname HelloController
 * @Description TODO
 * @Date 2020/6/15 18:54
 * @Created by 刘
 */
@Controller
public class HelloController {

    @Autowired
    UserService userService;

    @RequestMapping("/hello")
    public String hello(Map<String,Object> maps){
        System.out.println("进入controller");
        maps.put("k1","asasa");
//        int i = 10/0;

        return "hello";
    }

    @GetMapping("/users")
    @ResponseBody
    public List<User> users(){
        return userService.getAllUsers();
    }
}
